
/*
 * Copyright (C) 2010 Bitglue. All rights reserved.
 *
 * $Id: EclipseServerBean.java bself $
 */

package org.eclipse.jetty.server.boot;

import org.eclipse.jetty.deploy.DeploymentManager;
import org.eclipse.jetty.server.Server;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * EclipseServerBean provides support for starting the
 * eclipse jetty server.
 * @author Bryan Patrick Self
 */
public class EclipseServerBean {

    private final Logger log = LoggerFactory.getLogger(getClass());
    private Server server;
    private DeploymentManager deploymentManager;

    public EclipseServerBean(final Server server, DeploymentManager deployMgr) {
        this.deploymentManager = deploymentManager;
        this.server = server;
        server.addBean(deployMgr);
        log.info("....[[ starting eclipse jetty web container ]]....");
        try {
            server.start();
            server.join();
        } catch (Exception ex) {
            log.error("start of jetty server failed", ex);
        }
    }

   public Server getServer() {
        return server;
   }

   public DeploymentManager getDeploymentManager() {
       return deploymentManager;
   }

}
